import java.util.Arrays;

public class 快慢索引去重 {
	public static void main(String[] args) {
		int[] arr = {1,1,2,3,5,6,6,6,6,7,8,9,9,10};
		int index = quChong(arr);
		System.out.println(Arrays.toString(
				Arrays.copyOfRange(arr, 0, index)));
		
	}

	private static int quChong(int[] arr) {
		int slow = 0;
		int fast = 1;
		
		while (fast < arr.length) {
			if (arr[slow] != arr[fast]) {
				arr[++slow] = arr[fast];
			}
			fast++;
		}
		return slow + 1;
	}

}
